package com.resign.carl.observer.api.impl;


import com.resign.carl.observer.api.DisplayElement;
import com.resign.carl.observer.api.Observer;
import com.resign.carl.observer.api.Subject;

/**
 * Created by carl.zhao on 2016/6/13.
 */
public class CurrentConditionsDisplay implements Observer,DisplayElement {

    private float temperature;
    private float humidity;
    private Subject weatherDate;
    public CurrentConditionsDisplay(Subject weatherDate){
        this.weatherDate = weatherDate;
    }

    @Override
    public void display() {
        System.out.println("Current conditions: " + temperature + "F degrees and "
                + humidity + "% humidity");
    }

    @Override
    public void update(float temperature, float humidity, float pressure) {
        this.temperature = temperature;
        this.humidity = humidity;
        display();
    }
}
